import {COLLAPSE,MENU_SELECT} from '../types/AppActionType'

const initState = {
  collapsed: true,
  selectedMenuKeys:['live']
}

const appReducer = (state = initState, dispatch) => {
  switch (dispatch.type) {
    case COLLAPSE: {
      return {
        ...state,
        collapsed: !state.collapsed
      }
    }
    case MENU_SELECT:{
      return {
        ...state,
        selectedMenuKeys: dispatch.payload
      }
    }
    default:
      return state
  }
}

export default appReducer